<?php
namespace Hive\Mission;
/**
 * Mission Type,
 * 
 * It represent a type of mission, it maintains also the kind of workflow
 * that should be used
 * 
 *
 * @author Xavier VILAIN
 * @package Hive\Mission
 *
 * @property string	$type		Id of the Source
 * @property string $language	Default Language
 * @property string	$label		Source name
 * @property int	$wid		Id of the workflow
 * @property string	$currency	Default Currency
 * @property bool	$standard	Is a standard type (can't be changed)
 * @property bool	$active		Active ?
 * 
 */
class Type  extends \Fox\Object\Customizing {

	/**
	 * Reverse Link to Workflow
	 * @var string
	 */
	const LINK_WORKFLOW = "workflow";
	
	/**
	 * Reverse Link to Missions
	 * @var string
	 */
	const LINK_MISSIONS = "missions";
	
	/**
	 * Reverse Link to Mission Type from workflow
	 * @var string
	 */
	const LINK_MISSION_TYPE = "missionType";
			
	/**
	 * 
	 * Standard Type
	 * @var string
	 */
	const STANDARD = "1";
	
}
\Fox\Dao::infos(Type::className(),new \Fox\Object\Info('mission_types', \Fox\Databases::DB_APP));
// Link to Workflow
\Fox\Object\Links::add(\Fox\Dao::link(\Hive\Workflow::className(),Type::LINK_MISSION_TYPE)
	->to(Type::className(),Type::LINK_WORKFLOW)
	->on('wid')
	->oneToOne()
	->linkOnly()
);
// Link to Publishing Sites
/*
\Fox\Object\Links::add(\Fox\Dao::link(\Hive\Workflow::className(),Type::LINK_MISSION_TYPE)
	->to(Type::className(),Type::LINK_I18N)
	->on('wid')
	->oneToOne()
	->linkOnly()
);
*/
\Fox\Dao::useZone(Type::className(),new \Fox\Dao\DiskTimeCacheZone(\Fox\Dao\DiskTimeCacheZone::PERIOD_FOREVER,Type::cacheDirectory()));

